export const columns = (context, label) => {
  return [
    {
      prop: 'status',
      label,
      render: (h, row) => {
        return (<el-image style="width: 60px; height: 60px;border-radius:10px;" src={row.iconUrl} fit="contain" />)
      }
    },
    {
      prop: 'approveName',
      minWidth: 150
    },
    // {
    //   prop: 'status',
    //   minWidth: 200,
    //   render: (h, row) => {
    //     return [
    //       <div class="mb10">审批状态</div>,
    //       <div class={row.status === '1' ? 'text-primary' : ''}>
    //         {row.status === '1' ? '开启' : '关闭'}
    //       </div>
    //     ]
    //   }
    // },
    {
      minWidth: 200,
      render: (h, row) => {
        return [
          <el-button
            type="text"
            class="mr20"
            onClick={() => context.onEdit(row)}
          >
            <i class="el-icon-edit fs20" />
          </el-button>,
          <zm-switch
            value={row.status}
            active-value="1"
            inactive-value="0"
            // active-color=""
            inactive-color="#666"
            active-text="开启"
            inactive-text="关闭"
            onChange={() => context.onSwitch(row)}
          />
        ]
      }
    }
  ]
}

export const formRuleOne = {
  approveName: [
    {
      required: true,
      message: '请输入审批名称',
      trigger: 'blur'
    },
    {
      pattern: '[^ \x22]+',
      message: '至少输入一个字符'
    }
  ],
  iconUrl: [
    {
      required: true,
      message: '请上传审批流图标',
      trigger: 'blur'
    }
  ],
  isEdit: [
    {
      required: true,
      message: '请选择审批操作',
      trigger: 'blur'
    }
  ],
  isRepeat: [
    {
      required: true,
      message: '请选择审批人去重设置',
      trigger: 'blur'
    }
  ],
  isCountersign: [
    {
      required: true,
      message: '请选择审批类型',
      trigger: 'blur'
    }
  ]
}

export const defaultItem = {
  flowId: '',
  flowName: '',
  isEditName: false,
  nodeData: {
    sponsorNode: [
      {
        nodeId: '',
        nodeType: '1',
        pId: '',
        accountType: '1',
        accountId: '',
        accountLabel: ''
      }
    ],
    approveNode: [
      {
        nodeId: '',
        nodeType: '2',
        pId: '',
        accountType: '1',
        accountId: '',
        accountLabel: ''
      }
    ],
    copyNode: [
      {
        nodeId: '',
        nodeType: '3',
        pId: '',
        accountType: '1',
        accountId: '',
        accountLabel: ''
      }
    ]
  }
}
